// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';
 
/** 获取系统列表*/
export async function getSystems(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.SystemList>('/api/v1/system/list', {
    method: 'POST',
    data:{
      "filter": {},
      "limit": params.pageSize,
      "offset": params.current,
      "sort": []
    },
  });
}

/** 获取系统信息*/
export async function getSystemById(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.SystemList>('/api/rule', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
/** 更新规则*/
export async function updateSystemById(options?: { [key: string]: any }) {
  return request<API.SystemListItem>('/api/rule', {
    method: 'POST',
    data:{
      method: 'update',
      ...(options || {}),
    }
  });
}

/** 新建规则*/
export async function createSystem(options?: { [key: string]: any }) {
  return request<API.SystemListItem>('/api/rule', {
    method: 'POST',
    data:{
      method: 'post',
      ...(options || {}),
    }
  });
}

/** 删除规则*/
export async function deleteSystemById(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/rule', {
    method: 'POST',
    data:{
      method: 'delete',
      ...(options || {}),
    }
  });
}
